#import "RNCountBoxView.h"
#import "RNConstants.h"

static NSColor *countBoxColor;
static NSBezierPath *listCountPath;

@implementation RNCountBoxView

+(void)initialize {
//    countBoxColor = [NSColor colorWithCalibratedRed:0.760 green:0.797 blue:0.857 alpha:1.000];
    countBoxColor = [NSColor colorWithCalibratedRed:0.789 green:0.831 blue:0.920 alpha:1.000];
    NSRect listCountRect = NSMakeRect(0, 0, RNCountBoxWidth, RNGenericCellHeight);
    CGFloat maxX = NSMaxX(listCountRect);
    CGFloat maxY = NSMaxY(listCountRect);
    listCountPath = [NSBezierPath bezierPath];
    [listCountPath moveToPoint:NSMakePoint(maxX, maxY)];
    [listCountPath lineToPoint:NSMakePoint(RNDetailViewCellCornerRadius, maxY)];
    [listCountPath appendBezierPathWithArcFromPoint:NSMakePoint(0, maxY) toPoint:NSMakePoint(0, maxY - RNDetailViewCellCornerRadius) radius:RNDetailViewCellCornerRadius];
    [listCountPath lineToPoint:NSMakePoint(0, 0)];
    [listCountPath lineToPoint:NSMakePoint(maxX, 0)];
    [listCountPath closePath];
}

-(void)drawRect:(NSRect)frame {
    // Draw count box
    [countBoxColor setFill];
    [listCountPath fill];
}

@end
